import Koa from 'koa';
import mount from 'koa-mount';
import graphqlHTTP from '../src/';
import { buildSchema } from 'graphql';
 // Construct a schema, using GraphQL schema language
var schema = buildSchema(`
  type Query {
    hello: String
  }
`);
 // The root provides a resolver function for each API endpoint
var root = {
  hello: () => 'Hello world!',
};
var app = new Koa();
app.use(mount('/graphql', graphqlHTTP({
  schema: schema,
  rootValue: root,
  graphiql: true,
})));
app.listen(4000);
console.log('Running a GraphQL API server at http://localhost:4000/graphql');